import 'package:enterprise_v6_app/app/components/special_operation/custom_select_function.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/data/entities/application/smart_warehouse/warehouse_entity.dart';
import 'package:enterprise_v6_app/app/modules/application/smart_warehouse/smart_warehouse_controller.dart';

class ProductStorageController extends GetxController {
  /// 是否已经是长连接状态
  bool isConnection = false;

  /// 选中的仓库
  WarehouseEntity? choiceBean;

  /// 选择仓库
  void selectWarehouse() {
    final warehouseList = Get.find<SmartWarehouseController>().warehouseList;
    CustomSelectFunction.selectMultipleBottomSheet<WarehouseEntity>(
      title: '仓库选择',
      dataList: warehouseList,
      checkedList: choiceBean == null ? [] : [choiceBean!],
      isMultiple: false,
      onCallBack: (value) {
        choiceBean = value[0];
        update();
      },
    );
  }

  /// 开始出入库操作
  void startExecution() {
    isConnection = true;
    update();
  }

  /// 操作完成回调
  void executionCompletion() {
    isConnection = false;
    update();
  }
}
